//
// Created by xili on 2024/9/9 14:12.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    vector <vector<int>> ans;
    vector<int> temp;
    int N;
    int K;

    vector <vector<int>> combine(int n, int k) {
        this->N = n;
        this->K = k;
        dfs(1);
        return ans;
    }

    void dfs(int cur) {
        if (temp.size() == K) {
            ans.push_back(temp);
            return;
        }
        if (cur > N) {
            return;
        }
        temp.push_back(cur);
        dfs(cur + 1);
        temp.pop_back();
        dfs(cur + 1);
    }
};